package com.itheima.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zzw
 * @date 2025/10/26
 * @description 迭代器模式（具体聚合角色）
 */
public class StudentAggregateImpl implements StudentAggregate {

    private final List<Student> list = new ArrayList<>();

    @Override
    public void addStudent(Student student) {
        this.list.add(student);
    }

    @Override
    public void removeStudent(Student student) {
        this.list.remove(student);
    }

    @Override
    public StudentIterator getStudentIterator() {
        return new StudentIteratorImpl(list);
    }
}
